/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 artifact_prop_single_spell.h

	$Header: /heroes4/artifact_prop_single_spell.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( ARTIFACT_PROP_SINGLE_SPELL_H_INCLUDED )
#define ARTIFACT_PROP_SINGLE_SPELL_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "artifact_prop_effect.h"

namespace t_artifact_prop
{
	// ----------------------------------------------------------------------
	// class for artifacts with a single spell effect
	// ----------------------------------------------------------------------
	class t_single_spell : public t_artifact_effect
	{
	public:
		void init( t_spell spell, t_artifact_target target, int amount = 0 );

		virtual bool accept( t_artifact_effect_visitor& visitor );
		virtual int  get_level() const;
		t_spell      get_spell() const;
		virtual bool read( std::streambuf& buffer );
		void         set_spell( t_spell spell );
		virtual bool write( std::streambuf& buffer ) const;
	protected:
		t_spell m_spell;
	};

	inline void t_single_spell::init( t_spell spell, t_artifact_target target, 
		                                              int amount )
	{
		t_artifact_effect::init( target, amount );
		m_spell = spell;
	}

	inline t_spell t_single_spell::get_spell() const
	{
		return m_spell;
	}

	inline void t_single_spell::set_spell( t_spell spell )
	{
		m_spell = spell;
	}

	typedef t_effect< t_single_spell, k_artifact_effect_cast_spell >	t_cast_spell;
	typedef t_effect< t_single_spell, k_artifact_effect_learn_spell >	t_learn_spell;
	typedef t_effect< t_single_spell, k_artifact_effect_spell >			t_spell_effect;
};

#endif // ARTIFACT_PROP_SINGLE_SPELL_H_INCLUDED